#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2019/12/31 09:00|09:00
# @Author  : yangdingyi
# @File    : 最长连续序列
# @Software: PyCharm
from typing import List


class Solution:
    def longestConsecutive(self, nums: List[int]) -> int:
        head = {}
        tail = {}
        ans = 0


